package net.gz01.wallet.web.controller.admin;

import java.io.File;

import com.jfinal.plugin.activerecord.Page;

import net.gz01.wallet.common.PageRespon;
import net.gz01.wallet.common.ZOSearchCondition;
import net.gz01.wallet.web.controller.BaseController;
import net.gz01.wallet.web.model.Account;
import net.gz01.wallet.web.service.ReportService;

public class AccountController extends BaseController {
	public void search() {
		render("basedata/accountList.html");
	}

	public void listJson() {
		ZOSearchCondition sc = super.getSearchCondition();
		Page<Account> pageResult = Account.dao.search(sc);
		renderJson(new PageRespon(pageResult));
	}

	public void changeEnable() {
		Account.dao.changeEnable(getPara("id"));
		renderSuccess(false);
	}

	public void download() {
		ReportService reportService = new ReportService();
		File file = null;
		{
			file = reportService.virtualBalance_youli();
		}
		if (file == null) {
			renderFail("没有满足条件的数据");
		} else {
			renderFile(file);
		}
	}

}
